<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>2D转换</title>
    <style>
        .demo1 {
            width: 200px;
            height: 200px;
            background-color: skyblue;
            transform: translate(100px, 100px);
        }

        .demo2 {
            position: relative;
            height: 500px;
            width: 500px;
            background-color: purple;
        }

        .demo3 {
            position: absolute;
            top: 50%;
            left: 50%;
            width: 200px;
            height: 200px;
            transform: translate(-50%, -50%);
            background-color: #fff;
        }

        .demo4 {
            height: 300px;
            width: 300px;
            background-color: chartreuse;
            transform: rotate(45deg);
        }
    </style>
</head>

<body>

    <div class="demo1"></div>

    <div class="demo2">
        <div class="demo3">
        </div>
    </div>

    <div class="demo4"></div>
</body>

</html>